<?php
    $sql = "SELECT project_nr, p_name, get, client_id FROM project WHERE get=3 AND year != '" . date('Y') . "' ORDER BY project_nr DESC";
    $result = mysql_query($sql);

    if (mysql_num_rows($result) > 0) {
        echo '<li class="ui-li ui-li-divider ui-btn ui-bar-b ui-btn-up-undefined" data-role="list-divider" data-role="heading">Auftrag & Erledigt</li>';
        while ($data = mysql_fetch_array($result)) {
            echo '<li data-icon="false"><a href="edit.php?project_nr=' . $data['project_nr'] .
                            '&client_id=' . $data['client_id'] . '">
                      <h3 style="color:orange">A ' . $data['project_nr'] . '</h3>
                      <p><strong>' . $data['p_name'] . '</strong></p>
                      <p class="ui-li-aside"><img src="../assets/images/projects/accept-icon.png" style="width:28px; margin: 8px" /></p>
                  </a></li>';
        }
        $noproject = false;
    }

    $sql = "SELECT project_nr, p_name, get, client_id FROM project WHERE get=2 AND year != '" . date('Y') . "' ORDER BY project_nr DESC";
    $result = mysql_query($sql);

    if (mysql_num_rows($result) > 0) {
        echo '<li class="ui-li ui-li-divider ui-btn ui-bar-b ui-btn-up-undefined" data-role="list-divider" data-role="heading">Kein Auftrag</li>';
        while ($data = mysql_fetch_array($result)) {
            echo '<li data-icon="false"><a href="edit.php?project_nr=' . $data['project_nr'] .
                            '&client_id=' . $data['client_id'] . '">
                      <h3 style="color:orange">A ' . $data['project_nr'] . '</h3>
                      <p><strong>' . $data['p_name'] . '</strong></p>
                      <p class="ui-li-aside"><img src="../assets/images/projects/dont-icon.png" style="width:28px; margin: 8px" /></p>
                  </a></li>';
        }
        $noproject = false;
    }

    if ($noproject) {
?>
        <li class="ui-li ui-li-static ui-body-c ui-corner-top">
            <table align="center">
                <tr>
                    <td style="vertical-align: middle; text-align:center">
                            Keine Projekte im Archiv vorhanden!
                    </td>
                </tr>
            </table>
        </li>
<?php
    }
?>
